//
//  TMConst.h
//  复合发行4.0
//
//  Created by liubowen on 2017/8/30.
//  Copyright © 2017年 Beijing TMYK Technology co.,ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
typedef enum CompelteState {
    CompelteStateTakeGoods  = 0,//待收货
    CompelteStateWait, //待完成
    CompelteStateComment,//待评价
    CompelteStateOver,//完成
    CompelteStateRefund //待退款
} CompelteState;

typedef enum WhereDiscount {
    WhereDiscountGet  = 0,
    WhereDiscountUse,
    WhereDiscountList
} WhereDiscount;

//互动交流，会议交流HOST
#define kcommunicationHOST @"101.200.197.125"
//图文直播HOST
#define kpicTextHOST @"101.200.196.33"

// 互动交流端口
#define kcommunicationport 9000

//图文直播端口
#define kpicTextport 9001

//会议交流端口
#define kMeetingcommunicationport 9002


#define ITUNES_APP_ID @"1276981746"

#define KTMAPI_AppKey @"15b9ecf1d0151ef1bc77325688d4a6d9"
#define KTMApI_IdentifyKey @"755f0a6290e385f4cbc67984be19c501"

//复合发行报纸名称ID
#define kNewsPaperID 32328

//复合发行最新一期广告ID
#define kNewspapertAdID 1


//选题分类ID
#define kTypeSelcectID 680


//复合发行最新一期广告ID
#define kNewspapertAdID 1


//yao gai de
//复合发行期刊模块广告ID
#define kJournalAdID 20
//复合发行期刊,五星名刊ID
#define kJournalFamousID 10
//复合发行期刊,最新更新ID
#define kJournalLatestID 73
//复合发行期刊,热门推荐ID
#define kJournalTrendID 74

#define kHotListenID 13

//专区，报刊风采广告ID
#define kCPPCC_AD_ID 111

//复合发行行业动态广告ID
#define kNewsAdID 6

// 验证码信息发送有效时间（秒）
#define TMSmsValidTime 300


//本刊广告ID
#define kOwnJournalADID 119


//发现头部广告
#define kMallMainAdID 148

#define UMSociaAppKey @"5b8764ec8f4a9d1161000162"

#define UMSociaWechatAppKey @"wx8e4aace280ca985b"
#define UMSociaWechatAppSecret @"450dd2797faa16938c25044ecd89abe9"

#define UMSociaQQAppKey @"1107800582"
#define UMSociaQQAppSecret @"0kvh3vajLZji3Amt"

#define AMapAppKey @"5c4f6de6b2dbb94a69a54ca73a1d1a60"
#define IMClodeAppKey @"e0x9wycfe41uq"
#define  PATH_USER              @"userImformation"
//qf3d5gbjqhrjh  e0x9wycfe41uq
//应用基本信息
#define Kapp_old_id @"Kapp_old_id"
#define Kapp_name @"Kapp_name"
#define Kapp_type @"Kapp_type"
#define KShareQRCode @"KShareQRCode"
#define KHelp @"KHelp"

//UserDefaults Key
#define KArticleFontSize   @"KArticleFontSize"
#define KArticleThemeModel @"KArticleThemeModel"

#define KNewspaperReadLimit @"KNewspaperReadLimit"
#define KNewspaperReadLimititem @"KNewspaperReadLimititem"
#define KMagazineReadLimit @"KMagazineReadLimit"
#define KNovelReadLimit @"KNovelReadLimit"
#define KListenReadLimit @"KListenReadLimit"
#define KDownloadOnlyWiFi @"KDownloadOnlyWiFi"
#define kNightModel @"kNightModel"


#define KPushmessage_name @"message_name"
#define KPushmessage_image @"message_image"
#define KPushmessage_content @"message_content"
#define KPushmessage_time @"message_time"
#define KPushmessage_url @"message_url"
#define KPushmessage_infoID @"message_id"

/*************** Listen ***************/

extern NSString * _Nonnull const TMListenDownloadInterruptionNotification;
extern NSString * _Nonnull const TMListenInsertBookrackSuccessNotification;

/*************** Listen ***************/


#define STORY_BOARD(name, identify) [[UIStoryboard storyboardWithName:name bundle:nil] instantiateViewControllerWithIdentifier:identify]

#define NIB(name) [UINib nibWithNibName:name bundle:nil]

#pragma mark - 屏幕相关
#define kWindowH   [UIScreen mainScreen].bounds.size.height //应用程序的屏幕高度
#define kWindowW   [UIScreen mainScreen].bounds.size.width  //应用程序的屏幕宽度
#define kPlaceholder  [UIImage imageNamed:@"登录背景"]
#define Device_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)

#define TMRGBColor(r,g,b)  [UIColor colorWithRed:(r)/255.0f green:(g)/255.0f blue:(b)/255.0f alpha:1]
#define KSlectRedColor     [UIColor hx_colorWithHexRGBAString:@"f44336" alpha:1.0f]
#define KNabRedColor       [UIColor hx_colorWithHexRGBAString:@"d93532" alpha:1.0f]
#define KSelectTabbarColor TMRGBColor(70,135,255)
#define  COL_NAV_BAR  [UIColor hx_colorWithHexRGBAString:@"E44F0F"]
//设备UUID
#define UUID [[UIDevice currentDevice] uuid]
//当前版本号
#define CurrentVersion [[[NSBundle mainBundle]infoDictionary]objectForKey:@"CFBundleShortVersionString"]

#define TMApplication (AppDelegate *)[[UIApplication sharedApplication] delegate]

#define kIconWidth 32



//报纸下载文件夹路径
#define NewspaperDownloadFolder(newspaper_item_id) [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Library/Download/Newspaper/%@",newspaper_item_id]]
//报纸下载文件路径
#define NewspaperDownloadPath(newspaper_item_id,newspaper_article_id) [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Library/Download/Newspaper/%@/%@.newspaper",newspaper_item_id,newspaper_article_id]]

//杂志下载文件夹路径
#define MagazineDownloadFolder(magazine_item_id) [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Library/Download/Magazine/%@",magazine_item_id]]

//杂志下载文件路径
#define MagazineDownloadPath(magazine_item_id,magazine_chapter_id) [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Library/Download/Magazine/%@/%@.magazine",magazine_item_id,magazine_chapter_id]]

#define KHaveNoRedcard @"未购买阅读卡"
#define KHaveNoPermissions @"未激活"
#define KHaveHadPermissions @"已激活"
#define KTMShowDownloadFailure @"下载失败，点击重试"
#define KTMShowDeleteDownloadSuccess @"删除成功！"
#define KTMShowDeleteDownCompleteSuccess @"删除章节成功！"
#define KTMShowDeleteDownCompleteFailure @"删除章节失败！"

#define SHOW_LOGIN_ALERT UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"您的账号已在另一台设备登录，如无授权，请修改密码" message:@"" preferredStyle:UIAlertControllerStyleAlert handler:^(UIAlertAction * _Nonnull action) {\
if ([action.title isEqualToString:@"登录"]) {\
UIViewController *login = STORY_BOARD(@"Mine", @"TMLoginController");\
[[SPToolSet currentViewController].navigationController pushViewController:login animated:YES];\
}\
if ([action.title isEqualToString:@"取消"]) {\
UIViewController *login = STORY_BOARD(@"Mine", @"TMLoginController");\
[[SPToolSet currentViewController].navigationController pushViewController:login animated:YES];\
}\
} cancelButtonTitle:@"取消" otherButtonTitles:@"登录", nil];\
[[SPToolSet currentViewController] presentViewController:alert animated:YES completion:nil];


#define MUST_LOGIN_ALERT UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"您还没有登录，点击确认登录" message:@"" preferredStyle:UIAlertControllerStyleAlert handler:^(UIAlertAction * _Nonnull action) {\
if ([action.title isEqualToString:@"登录"]) {\
UIViewController *login = STORY_BOARD(@"Mine", @"TMLoginController");\
[[SPToolSet currentViewController].navigationController pushViewController:login animated:YES];\
}\
} cancelButtonTitle:@"取消" otherButtonTitles:@"登录", nil];\
[[SPToolSet currentViewController] presentViewController:alert animated:YES completion:nil];


NS_ASSUME_NONNULL_BEGIN





/** 发现占位图名字 */
extern NSString *const FindPlaceholderImageName;

//期刊
extern NSString *const TMmagazineDownloadProgressNotification;
extern NSString *const TMmagazineDownloadSuccessNotification;
extern NSString *const TMmagazineZanClickSuccessNotification;
extern NSString *const TMmagazineZanClickSuccessnotloginNotification;
extern NSString *const TMmagazineZanClickfinishSuccessNotification;
extern NSString *const TMMagazineDeleteSuccessNotification;
extern NSString *const TMMagazineClassChangedNotification;

//报纸
extern NSString *const TMDownloadDeleteSuccessNotification;
extern NSString *const TMNewspaperDownloadSuccessNotification;
extern NSString *const TMnewspaperHotPointsDidClickNotification;
#pragma mark---文章正文页
/* WebView高度通知*/
extern NSString *const TMArticleContentWebViewHeight;
/* 评论提交成功*/
extern NSString *const TMCommentsendSuccess;
/* 设置字体字号的变大变小*/
extern NSString *const TMArticleFontSizeIncreaseOrReductionNotification;
/* 文章字号*/
extern NSString *const TMArticleFontSize;
/* 设置正文背景色*/
extern NSString *const TMArticleBGColorChangeNotification;
/* 文章背景色*/
extern NSString *const TMArticleBGColor;

/* 设置正文缩进方式*/
extern NSString *const TMArticleIndentChangeNotification;
/* 文章缩进*/
extern NSString *const TMArticleIndent;
/* 文章评论删除*/
extern NSString *const TMArticleCommentDeleteSuccessNotification;
/* 文章收藏和删除收藏操作*/
extern NSString *const TMArticleCollectionoperationNotification;
//用户
extern NSString *const TMUserManagerDidLoginNotification;
extern NSString *const TMUserManagerRegisterSuccessNotification;
extern NSString *const TMUserManagerSendSMSCodeNotification;
extern NSString *const TMUserManagerSendSMSCodeErrorNotification;
extern NSString *const TMUserManageriIdentitySendSMSCodeNotification;
extern NSString *const TMUserManagerIdentitySendSMSCodeErrorNotification;
extern NSString *const TMUserManagerFailedLoginNotification;
extern NSString *const TMUserManagerDidLogoutNotification;
extern NSString *const TMUserManagerChangePasswordNotification;
extern NSString *const TMUserManagerCancleChangePawNotification;
extern NSString *const TMUserManagerSaveChangePawNotification;
extern NSString *const TMUserManagerActiveReadCardNotification;
extern NSString *const TMUserManagerRetrievePasswordSuccessNotification;

extern NSString *const TMUserManagerFeedBackSuccessNotification;

extern NSString *const TMUserManagerActiveReadCardFailNotification;
extern NSString *const TMowniconLoadSuccessNotification;
extern NSString *const TMnicknameLoadSuccessNotification;
extern NSString *const TMHistoryDeleteSuccessNotification;


extern NSString *const TMNewsListrefreshDataNotification;

extern NSString *const TMVersionManagerGetVersionReviewStateNotification;


extern NSString *const TMReadMainTableViewDidScrollNotification;


// ---------------- 发现 ----------------
extern NSString *const TMIntegralMallMAinCollectionCellDidClick;
extern NSString *const TMIntegralMallMAllGoodsCellDidClick;
extern NSString *const TMIntegralMallMAllGoodsSubmitStateSuccessNotification;


NS_ASSUME_NONNULL_END

// ---------------- 字符串高度 -> BEGIN ----------------

// 跟屏幕大小设置字体大小
float sizeForScreen(float width);
float fontSizeForDevice(void);
// 获得字符串的高度
float heightForString(NSString * _Nullable value, float fontSize, float width);
// 获取字符串的宽度
float widthForString(NSString * _Nullable value, float fontSize, float height);

// ---------------- 字符串高度 -> END ----------------




